<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<form:form commandName="coordinate" cssClass="form-horizontal" role="form">
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="problemName">问题名称</label>
        <div class="col-sm-4">
            <input type="text" name="problemName" id="problemName" class="form-control" required/>
        </div>

    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="industryId">指标名称</label>
        <div class="col-sm-4">
            <select name="industryId" id="industryId" class="form-control" required>
                <option value="">--请选择--</option>
                <c:forEach items="${industries }" var="industries">
                    <option value="${industries.sysId}">${industries.indicatorName}</option>
                </c:forEach>
            </select>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="industryDate">指标时间</label>
        <div class="col-sm-4">
            <input type="text" name="industryDate" id="industryDate" placeholder="点击选择"
                   class="form-control date-picker1" required/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="baseInfo">基本情况</label>
        <div class="col-sm-10">
            <textarea rows="2" id="baseInfo" name="baseInfo" class="form-control" required></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="helpInfo">需协调事项</label>
        <div class="col-sm-10">
            <textarea id="helpInfo" name="helpInfo" rows="2" class="form-control" required></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="groupCode_create">督查组</label>
        <div class="col-sm-4">
            <select name="groupCode" id="groupCode_create"
                    class="form-control <%--departments--%>" <%--multiple="multiple"--%> required>
                <option value="">--请选择--</option>
                <c:forEach items="${supervisionList }" var="supervisionList">
                    <option value="${supervisionList.sysId}">${supervisionList.deptName}</option>
                </c:forEach>
            </select>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="deptId_create">责任单位</label>
        <div class="col-sm-4">
            <select name="deptId" id="deptId_create" class="form-control " required>
                <option value="">--请选择--</option>
                <c:forEach items="${resDepts }" var="resDepts">
                    <option value="${resDepts.sysId}">${resDepts.deptName}</option>
                </c:forEach>
            </select>
        </div>

    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="inspectors_create">督查组成员</label>
        <div class="col-sm-4">
            <input type="text" name="inspectors" id="inspectors_create" class="form-control" readonly required/>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="resUser_create">责任人</label>
        <div class="col-sm-4">
            <input type="text" name="resUser" id="resUser_create" class="form-control" readonly required/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="phones_create">督查成员手机号</label>
        <div class="col-sm-4">
            <input type="text" name="phones" id="phones_create" class="form-control" readonly required/>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="resPhone_create">责任人手机号</label>
        <div class="col-sm-4">
            <input type="text" name="resPhone" id="resPhone_create" class="form-control" readonly required/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="userName">上报人</label>
        <div class="col-sm-4">
            <input type="text" id="userName" class="form-control" value="${bnpUser.name}" readonly/>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="source">来源</label>
        <div class="col-sm-4">
            <input type="text" name="source" id="source" class="form-control" required/>
        </div>
    </div>
    <input type="text" id="sysId" value="${coordinate.sysId}" hidden/>
    <input type="text" id="userId_create" name="userId"  hidden/>
    <form:hidden path="sysId"/>
    <%--<form:hidden path="maxVal"/>
    <form:hidden path="minVal"/> --%>
</form:form>

<script>
    $(function () {

        $("#deptId_create").change(function () {
            var deptId = $("#deptId_create").val();
            $.ajax({
                url: "/jobmanages/queryResUserByDeptId",
                type: "GET",
                dataType: "json", //返回数据形式为json
                contentType: 'application/json;charset=UTF-8',
                async: true,
                data: {"deptId": deptId},
                success: function (res) {
                    if (res != null) {
                        debugger;
                        $("#resUser_create").val(res.name);
                        $("#resPhone_create").val(res.mobile);
                        $("#userId_create").val(res.userId);
                    }
                }
            });
        });

        $("#groupCode_create").change(function () {
            var groupCode = $("#groupCode_create").val();
            $.ajax({
                url: "/jobmanages/querySupervisionUserByDeptId",
                type: "GET",
                dataType: "json", //返回数据形式为json
                contentType: 'application/json;charset=UTF-8',
                async: true,
                data: {"deptId": groupCode},
                success: function (res) {
                    if (res != null) {
                        $("#inspectors_create").val(res.name);
                        $("#phones_create").val(res.mobile);
                    }
                }
            });
        });

        $(".date-picker1").datepicker({
            inline: true,
            format: "yyyymm",
            autoclose: true,
            todayHighlight: true,
            language: 'cn'
        }).next().on(ace.click_event, function () {
            $(this).prev().focus();
        });
    })

</script>
